package client;

import java.io.IOException;
import java.net.Socket;
import java.net.UnknownHostException;

public class ClientSocket {
	
	static final String HOST = "127.0.0.1";
	Socket conexao;
	
	ClientSocket (){
		conectar(HOST);
	}

	public Socket getSocket(){
		return conexao;
	}
	
	public boolean conectado(){
		if(conexao.isConnected()){
			return true;
		}else{
			return false;
		}
	}

	public void conectar(String host){
		try{
			conexao = new Socket(host, 7001);
        } catch (UnknownHostException e) {
            System.out.println("Este servidor não foi encontrado");
        } catch (IOException e) {
            System.out.println("Falha na Conexao... .. ." + " IOException: " + e);
        }
	}

}

